package com.spring.demo.core.entity;

import java.io.Serializable;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Date;

import javax.xml.bind.annotation.XmlRootElement;

import org.springframework.jdbc.core.RowMapper;

@XmlRootElement
public class Ping implements Serializable, RowMapper<Ping> {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	private Long id;
	private Integer age;
	private String name;
	private Date createTime;
	private Date updateTime;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Integer getAge() {
		return age;
	}

	public void setAge(Integer age) {
		this.age = age;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public Date getUpdateTime() {
		return updateTime;
	}

	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}

	@Override
	public Ping mapRow(ResultSet rs, int rowNum) throws SQLException {
		Ping ping = new Ping();
		ping.setId(rs.getLong("id"));
		ping.setAge(rs.getInt("age"));
		ping.setName(rs.getString("name"));
		ping.setCreateTime(new Date(rs.getTimestamp("create_time").getTime()));
		ping.setUpdateTime(new Date(rs.getTimestamp("update_time").getTime()));
		return ping;
	}

}
